﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Microsoft.SqlServer.Server;
using System.Globalization;

namespace ConsoleApp1
{
    public class Program
    {



        static void Main(string[] args)
        {
            /*            int test1 =50000;

                        Console.WriteLine(string.Format("结果为：{0:C}",test1));
                        Console.WriteLine(string.Format("结果为：{0:E}",test1));
                        Console.WriteLine(string.Format("结果为：{0:N0}",test1));
                        Console.WriteLine(string.Format("结果为：{0:F2}",test1));
                        Console.WriteLine(string.Format("结果为：{0:X4}",test1));
                        Console.WriteLine(string.Format("结果为：{0:P0}",test1));

                        DateTime time=DateTime.Now;
                        Console.WriteLine(string.Format("结果为：{0:D}", time));
                        Console.WriteLine(string.Format("结果为：{0:F}", time));
                        Console.WriteLine(string.Format("结果为：{0:G}", time));
                        Console.WriteLine(time.ToString("f"));
                        Console.ReadLine();*/

            /*
                        string file = "Program.cs";
                        Console.WriteLine("完整名称："+file);
                        string fileName=file.Substring(0,file.IndexOf('.'));

                         Console.WriteLine(fileName);
                        string newNmae=file.Substring(file.IndexOf("."));
                        Console.WriteLine(newNmae);*/
            /*
                        string str = "让编程学习不再难,让编程创造财富不再难,让编程改变工作和人生不在再难";
                        char[] separ = { ','};
                        string[] splitStrings=str.Split(separ,StringSplitOptions.RemoveEmptyEntries);
                        for (int i = 0; i < splitStrings.Length; i++) 
                        {

                            Console.WriteLine(splitStrings[i]);
                        }*/

            /*
                        string str = "****";
                        string leftStr=str.PadLeft(8,'+');
                        string rightStr=str.PadRight(8,'-');
                        Console.WriteLine("【"+leftStr+"】");
                        Console.WriteLine("【"+rightStr+"】");

                        string removeStr = str.Remove(0,2);
                        Console.WriteLine(removeStr);*/
            /*
                        string str = "Do one thing at a time,and do well.";
                        char[] arr = new char[4];

                        str.CopyTo(str.IndexOf("time"), arr, 0, 4);
                        Console.WriteLine(arr);

                        string[] arr2 = new String[4] {"a","d","c","d"};
                        for (int i = 0; i < arr2.Length; i++) {
                            Console.WriteLine(arr2[i]);
                        }*/

            /*            string strOld = "HuaWei——华为 Tencent——腾讯 Alibaba——阿里巴巴";
                        Console.WriteLine(strOld.Replace('a', '='));*/
            /*            string strOld = "1A 3B F4 E6 C5 7F 8A 9C";
                        Console.WriteLine("旧的"+strOld);
                        Console.WriteLine("新的"+strOld.Replace(" ",""));*/

            /*            int Num = 368;
                        StringBuilder sb = new StringBuilder("明日科技");
                        sb.Append("》 c#字典编程");

                        Console.WriteLine(sb);

                        sb.AppendFormat("{0:C0}",Num);
                        Console.WriteLine(sb);
                        sb.Insert(0, "软件：");
                        Console.WriteLine(sb);

                        sb.Remove(14, sb.Length - 14);
                        Console.WriteLine(sb);

                        sb.Replace("软件", "软件工程师必备");
                        Console.WriteLine(sb);*/

           Console.WriteLine("请输入您的身份证号：");
            string number = Console.ReadLine();
            Console.WriteLine($"身份证号为：{number}");
            string shengri = number.Substring(6, 8);

            if (DateTime.TryParseExact(shengri, "yyyyMMdd", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime birthDate))
            {
                Console.WriteLine($"出生日期:{birthDate:yyyy年MM月dd日}");

            }

           
            int sex = Convert.ToInt32(number.Substring(16, 1));
            string sex_name;
            if (sex / 2 ==1)
            {
                 sex_name = "女";
            }
            else
            {
                sex_name = "男";
            }
            Console.WriteLine($"您的性别是：{sex_name}");
            Console.ReadLine();
         }


        
       
    
    }
}





   





